import 'package:shared_preferences/shared_preferences.dart';

class SPUtils {
  // 保存数据
  Future setUserInfo(key, value) async{
    SharedPreferences sp = await SharedPreferences.getInstance();
    sp.setString(key, value);
  }
  // 保存bool
  Future setBool(key, value) async{
    SharedPreferences sp = await SharedPreferences.getInstance();
    sp.setBool(key, value);

  }

  // 获取数据
  Future getUserInfo(key) async{
    SharedPreferences sp = await SharedPreferences.getInstance();
    return sp.get(key);
  }

  // 获取bool数据
  Future getBool(key) async{
    SharedPreferences sp = await SharedPreferences.getInstance();
    return sp.getBool(key);
  }


  // 清除数据
  Future deleteUserInfo(key) async{
    SharedPreferences sp = await SharedPreferences.getInstance();
    sp.remove(key);
  }
}